home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow / Capture / AudioCap / AudioCapDlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  4.0 KB  |  132 lines

  1. //------------------------------------------------------------------------------
  2. // File: AudioCapDlg.h
  3. //
  4. // Desc: DirectShow sample code - Main header for CAudioCapDlg class
  5. //
  6. // Copyright (c) 2000-2001 Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9. #if !defined(AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_)
  10. #define AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_
  11.  
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif // _MSC_VER > 1000
  15.  
  16. #include <dshow.h>
  17.  
  18. //
  19. //  Constants
  20. //
  21. #define DEFAULT_BUFFER_TIME ((float) 0.05)  /* 50 milliseconds*/
  22. #define DEFAULT_FILENAME    TEXT("c:\\test.wav\0")
  23. #define RECORD_EVENT        0
  24. #define PLAYBACK_EVENT      1
  25.  
  26. static const GUID CLSID_WavDest =
  27. { 0x3c78b8e2, 0x6c4d, 0x11d1, { 0xad, 0xe2, 0x0, 0x0, 0xf8, 0x75, 0x4b, 0x99 } };
  28.  
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CAudioCapDlg dialog
  32.  
  33. class CAudioCapDlg : public CDialog
  34. {
  35. // Construction
  36. public:
  37.     CAudioCapDlg(CWnd* pParent = NULL);    // standard constructor
  38.  
  39.     HRESULT FillLists(void);
  40.     void ClearLists(void);
  41.     void SetDefaults(void);
  42.     void EnableButtons(BOOL bEnable);
  43.     void EnableRadioButtons(BOOL bEnable);
  44.     HRESULT InitializeCapture(void);
  45.     HRESULT GetInterfaces(void);
  46.     HRESULT GetPlaybackInterfaces();
  47.     void FreeInterfaces(void);
  48.     void FreePlaybackInterfaces(void);
  49.     void ReleaseCapture(void);
  50.     void ResetCapture(void);
  51.     void UpdateFilterLists(IGraphBuilder *pGB);
  52.     HRESULT HandleGraphEvent(void);
  53.     HRESULT HandlePlaybackGraphEvent(void);
  54.     HRESULT SetInputPinProperties(IAMAudioInputMixer *pPinMixer);
  55.     HRESULT SetAudioProperties();
  56.     HRESULT ActivateSelectedInputPin(void);
  57.     HRESULT RenderPreviewStream(void);
  58.     HRESULT RenderCaptureStream(void);
  59.     HRESULT DestroyPreviewStream(void);
  60.     HRESULT DestroyCaptureStream(void);
  61.     void ClearAllocatedLists(void);
  62.     void Say(TCHAR *szMsg);
  63.  
  64. // Dialog Data
  65.     //{{AFX_DATA(CAudioCapDlg)
  66.     enum { IDD = IDD_AUDIOCAP_DIALOG };
  67.     CStatic    m_strStatus;
  68.     CButton    m_btnMono;
  69.     CButton    m_btn8BIT;
  70.     CButton    m_btn11KHZ;
  71.     CButton    m_btnPause;
  72.     CButton    m_btnStop;
  73.     CButton    m_btnPlay;
  74.     CListBox    m_ListFilterOutputs;
  75.     CListBox    m_ListFilterInputs;
  76.     CButton    m_btnRecord;
  77.     CButton    m_btnProperties;
  78.     CListBox    m_ListInputs;
  79.     CListBox    m_ListInputPins;
  80.     CListBox    m_ListFilters;
  81.     CEdit    m_StrFilename;
  82.     CButton    m_CheckWriteFile;
  83.     CButton    m_CheckAudition;
  84.     //}}AFX_DATA
  85.  
  86.     // ClassWizard generated virtual function overrides
  87.     //{{AFX_VIRTUAL(CAudioCapDlg)
  88.     protected:
  89.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  90.     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  91.     //}}AFX_VIRTUAL
  92.  
  93. // Implementation
  94. protected:
  95.     HICON m_hIcon;
  96.     BOOL m_bPausedRecording;
  97.     IGraphBuilder *m_pGB, *m_pGBPlayback;
  98.     IMediaControl *m_pMC, *m_pMCPlayback;
  99.     IMediaEventEx *m_pME, *m_pMEPlayback;
  100.  
  101.     ICaptureGraphBuilder2 *m_pCapture;
  102.  
  103.     IBaseFilter *m_pInputDevice, *m_pRenderer, *m_pFileWriter,
  104.                 *m_pSplitter,    *m_pWAVDest;
  105.  
  106.     // Generated message map functions
  107.     //{{AFX_MSG(CAudioCapDlg)
  108.     virtual BOOL OnInitDialog();
  109.     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  110.     afx_msg void OnPaint();
  111.     afx_msg HCURSOR OnQueryDragIcon();
  112.     afx_msg void OnClose();
  113.     afx_msg void OnButtonFile();
  114.     afx_msg void OnSelchangeListInputDevices();
  115.     afx_msg void OnSelchangeListFilters();
  116.     afx_msg void OnButtonClear();
  117.     afx_msg void OnSelchangeListInputPins();
  118.     afx_msg void OnButtonProperties();
  119.     afx_msg void OnButtonPlay();
  120.     afx_msg void OnButtonPause();
  121.     afx_msg void OnButtonStop();
  122.     afx_msg void OnButtonRecord();
  123.     afx_msg void OnDestroy();
  124.     //}}AFX_MSG
  125.     DECLARE_MESSAGE_MAP()
  126. };
  127.  
  128. //{{AFX_INSERT_LOCATION}}
  129. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  130.  
  131. #endif // !defined(AFX_AUDIOCAPDLG_H__CC9BF075_154D_430A_9E58_7311EC641C61__INCLUDED_)
  132.